export default function (data) {
    const router  = useRouter();

    const currentInfo = computed(()=>{
        return {
            subUrl:router.currentRoute.value.path,//获取当前二级菜单的信息
            subName:router.currentRoute.value.name,//获取当前二级菜单的信息
        };
    })
	
	
	let timer = null
	
	// let clientWidth = document.body.clientWidth ;
	
	//更改左边状态栏宽度
	if(data){
		function upMenustate(data){
			if(document.body.clientWidth > 960){
				data.showMenu  = true;
			}else{
				data.showMenu  = false;
			}
		}
		upMenustate(data);
		
		//监听窗口大小变化，50毫秒防抖
		function resizeHandler () {
		  if (timer) clearTimeout(timer);
		  timer = setTimeout(() => {
			 // clientWidth = document.body.clientWidth 
			upMenustate(data);
		  }, 50);
		}
		window.addEventListener('resize',function(){
			resizeHandler();
		})
	}



    return {
        currentInfo,
        router,
        pName:router.currentRoute.value.matched[0],//获取当前一级菜单的信息
    }
}